import re

class ReUtils:

    @staticmethod
    def extract_date(date_string):
        pattern = r'(\d{4})年(\d{1,2})月(\d{1,2})日.*'
        match = re.match(pattern, date_string)
        if match:
            year = match.group(1)
            month = match.group(2)
            day = match.group(3)
            return f"{year}-{month}-{day}"
        return None

    @staticmethod
    def extract_numbers(input_string):
        # 正则表达式模式，匹配包含小数点的数字
        pattern = r'-?\d+\.\d+|-?\d+'
        # 使用 re.findall 提取所有匹配的数字
        numbers = re.findall(pattern, input_string)
        # 将匹配的数字转换为浮点数
        numbers = [str(num) for num in numbers]
        return numbers